package com.css.zfzx.sjcj.modules.hddcB4_SampleDataTable.repository;

import com.css.zfzx.sjcj.modules.hddcA1InvRgnHasMaterialTable.repository.entity.HddcA1InvrgnhasmaterialtableEntity;
import com.css.zfzx.sjcj.modules.hddcB4_SampleDataTable.repository.entity.HddcB4SampledatatableEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author zhangcong
 * @date 2020-11-30
 */
public interface HddcB4SampledatatableRepository extends JpaRepository<HddcB4SampledatatableEntity, String> {
    @Modifying
    @Query(nativeQuery = true,value = "update hddc_b4_sampledatatable set qualityinspection_status=:s,extends1=:str where uuid=:uuid")
    void updateStatus(String s, String str, String uuid);
    @Modifying
    @Query(nativeQuery = true,value = "update hddc_b4_sampledatatable set qualityinspection_status=:s,extends2=:str where uuid=:uuid")
    void update2Status(String s, String str, String uuid);

    @Query(nativeQuery = true,value = "select * from hddc_b4_sampledatatable where is_valid=1 and (qualityinspection_status!=3 or qualityinspection_status is null)")
    List<HddcB4SampledatatableEntity> findByAll();

    HddcB4SampledatatableEntity findByUuidAndIsValid(String id, String isValid);

    HddcB4SampledatatableEntity findByProjectidAndIsValid(String id, String isValid);

    HddcB4SampledatatableEntity findBySamplepointidAndIsValid(String id, String isValid);
}
